<html metal:use-macro="here/main_template/macros/master">
<tal:comment tal:replace="nothing">

THIS REPORT MECHANISM IS INTENDED TO BE EDITED TO SPECIALIZED PURPOSES

</tal:comment>
<tal:block metal:fill-slot="top_slot" tal:define="dummy python:request.set('disable_border',1)"/>

<body metal:fill-slot="main"
    tal:define="assessmentStorageService python:here.knowledgeengine_assessmentstorageservice;
                assessment python:assessmentStorageService.loadAssessment( request['assessmentIdentity'] );
                utils python:modules['Products.CMFCore'].utils;
                userProviderService here/knowledgeengine_userproviderservice;
	                 user python:request.get('USER');
	                 now python:request.get('NOW');
	                 elements python:request.get('ELEMENTS');
	                 elements_by_type python:request.get('ELEMENTS_BY_TYPE');
	                 wizardState python:request.get('WIZARD_STATE');
                exitURL python:request.get('exitURL', wizardState.getPropertyValue('exitURL'));">

		<!-- Top Navigation Bar -->
		<table class="keToolbar">
		<tr>
			<td align="left" valign="top">
				<div class="keTitle"
				      tal:content="python:'%s - %s' % (assessment.getModel().getTitleOrId(), assessment.getName())">
					Model - Assessment Name
				</div>
				<div class="keMetaInformation"
					 tal:content="python:'Created on %s' % here.toLocalizedTime(assessment.getInstantCreated(), long_format='date_format_short')">
					Created on YYYY-MM-DD HH:MM PM
				</div>
				<div class="keMetaInformation"
					 tal:content="python:'Last Modified on %s' % here.toLocalizedTime(assessment.getInstantModified(), long_format='date_format_short')">
					Last Modified on YYYY-MM-DD HH:MM PM
				</div>
				<div class="keMetaInformation"
					 tal:condition="python:assessment.getIsLocked()">
					Current Status: Locked
				</div>
				<div class="keMetaInformation"
					 tal:condition="python:not assessment.getIsLocked()">
					Current Status: Unlocked
				</div>
				<div class="keMetaInformation"
           tal:define="fullname python:userProviderService.getUser(assessment.getCreatedBy()).getFullname();"
           tal:on-error="string:Report of - User: not available" 
					 tal:content="python:'Report of - User: %s' % fullname">
					Report of - User
				</div>
				<div class="keMetaInformation"
					 tal:content="python:'Report Generated on %s' % here.toLocalizedTime(now, long_format='date_format_short')">
					Generated on YYYY-MM-DD HH:MM PM
				</div>
            </td>
			<td align="right" valign="top">
				<input type="button" class="keButton" value="Save As HTML" onclick=""
					   tal:attributes="onclick python:'saveAsMe(\'%s - %s.html\')' % (here.getTitle(), here.getModel().getTitleOrId())" >
				<input type="button" class="keButton" value="Close" onclick=""
             tal:condition="request/exitURL|nothing"
					   tal:attributes="onclick python:'window.location=\'%s\'' % exitURL" />
				<input type="button" class="keButton" value="Back" onClick="history.go(-1)"
             tal:condition="not: request/exitURL|nothing" />				   
			</td>
			<td align="right" valign="top">
                <a href="javascript:this.print();">
                    <img src="/dummy/print_icon.gif" tal:attributes="src string:${portal_url}/print_icon.gif"
                         alt="Print this page"
                         title="Print this page" height="16"
                         width="16" />
                </a>
			</td>
		</tr>
		</table>
		<!-- /Top Navigation Bar -->

<table class="customTesting">

<tr tal:define="model      assessment/getModel;
                       reports    python:model.getReports(className='SimpleReport');
                       report     python:reports and reports[0] or None;
    ">
        <td>
            <a tal:attributes="href string:${model/absolute_url}/assess?assessmentIdentity=${assessment/getIdentity}&exitURL=demo_search_form"
               tal:content="assessment/getIdentity"/>
        </td>
</tr>
<tr tal:define="component python:here.getComponentByIdentity('chk01160096201958811024328'); state python:assessment.getComponentState(component.getIdentity())">
    <th>Choice Question (checkbox) by compID:</th>
    <td tal:content="structure python:component.getReportContentForValue(state.getValue())"/> 
</tr>

<tr>
    <th>Date (By component ID):</th>
    <td tal:on-error="nothing" tal:content="python:here.toLocalizedTime( assessment.getComponentByIdentityValue('datetimeselector01160096293300313182522') )"/>
</tr>
<tr>
    <th>Date (By shortname):</th>
    <td tal:on-error="nothing" tal:content="python:here.toLocalizedTime( assessment.getComponentByIdValue('datetimeselector') )"/>
</tr>

<tr>
    <th>Numeric Box (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('num011601087750244487961604') or 'Not Found'"/>
</tr>
<tr>
    <th>Numeric Box (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('numericbox') or 'Not Found'"/>
</tr>

<tr>
    <th>Multiple Choice (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('mch01160108598501785298309') or 'Not Found'"/>
</tr>
<tr>
    <th>Multiple Choice (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('multiplechoice') or 'Not Found'"/>
</tr>
<tr>
    <th>Multiple Choice (By shortname): (gets report value)</th>
        <td tal:define="component python:assessment.getComponentByIdentity('mch01173764415605231716189')"
            tal:content="python:component.getAnswerReportContent(assessment)"
            tal:on-error="string:ERROR"/>
</tr>
<tr tal:define="component python:here.getComponentByIdentity('para0116010899643537731032')">
    <th>Paragraph:</th>
    <td tal:content="structure python:component.getReportContent()"/> 
</tr>

<tr>
    <th>Selection with checkboxes:</th>
    <td tal:content="python:', '.join( assessment.getComponentByIdentityValue('sel011601090850994379641044'))"/>
</tr>

<tr>
    <th>Selection with radio buttons:</th>
    <td tal:content="python:', '.join( assessment.getComponentByIdentityValue('sel01160109422366242962945'))"/>
</tr>

<tr>
    <th>Selection with drop down:</th>
    <td tal:content="python:', '.join( assessment.getComponentByIdentityValue('sel01160116782383534522419'))"/>
</tr>

<tr>
    <th>Selection with multiselect:</th>
    <td tal:content="python:', '.join( assessment.getComponentByIdentityValue('sel01160117125899825774661'))"/>
</tr>

<tr>
    <th>Text Box (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('text01160117301552227446034') or 'Not Found'"/>
</tr>
<tr>
    <th>Text Box (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('textbox') or 'Not Found'"/>
</tr>

<tr>
    <th>Multi Line Text Box (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('text01160117313965751409454') or 'Not Found'"/>
</tr>
<tr>
    <th>Multi Line Text Box (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('multiline_textbox') or 'Not Found'"/>
</tr>

<tr>
    <th>File Upload (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('file01160698798625926548811') or 'Not Found'"/>
</tr>
<tr>
    <th>File Upload (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('fileupload') or 'Not Found'"/>
</tr>

<tr>
    <th>Link (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('link01160698918855786591087') or 'Not Found'"/>
</tr>
<tr>
    <th>Link (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('link') or 'Not Found'"/>
</tr>

<tr>
    <th>Entity Chooser (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('ec01160822920758659044059') or 'Not Found'"/>
</tr>
<tr>
    <th>Entity Chooser (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('entitychooser') or 'Not Found'"/>
</tr>

<tr>
    <th>Text Box Unique(By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('text01161831423334721099295') or 'Not Found'"/>
</tr>
<tr>
    <th>Text Box Unique(By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('textboxUnique') or 'Not Found'"/>
</tr>

<tr>
    <th>Text Box Mandatory and Unique(By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('text01161831501467345560941') or 'Not Found'"/>
</tr>
<tr>
    <th>Text Box Mandatory and Unique(By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('textboxMandatoryUnique') or 'Not Found'"/>
</tr>

<tr>
    <th>List (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('lookup01163998549117098404527') or 'Not Found'"/>
</tr>
<tr>
    <th>List (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('lookup.Users') or 'Not Found'"/>
</tr>

<tr>
    <th>Python Script (By component ID):</th>
    <td tal:content="python:assessment.getComponentByIdentityValue('py01163998664425659766108') or 'Not Found'"/>
</tr>
<tr>
    <th>Python Script (By shortname):</th>
    <td tal:content="python:assessment.getComponentByIdValue('pythonscriptFullnameRanNum') or 'Not Found'"/>
</tr>
</table>

		<!-- Bottom Navigation Bar -->
      <div style="clear: both;"/>
		<table class="keToolbar">
		<tr>
			<td align="left" valign="top">
				<div class="keTitle"
				      tal:content="python:'%s - %s' % (assessment.getModel().getTitleOrId(), assessment.getName())">
					Model - Assessment Name
				</div>
				<div class="keMetaInformation"
					 tal:content="python:'Created on %s' % here.toLocalizedTime(assessment.getInstantCreated(), long_format='date_format_short')">
					Created on YYYY-MM-DD HH:MM PM
				</div>
				<div class="keMetaInformation"
					 tal:content="python:'Last Modified on %s' % here.toLocalizedTime(assessment.getInstantModified(), long_format='date_format_short')">
					Last Modified on YYYY-MM-DD HH:MM PM
				</div>
				<div class="keMetaInformation"
					 tal:condition="python:assessment.getIsLocked()">
					Current Status: Locked
				</div>
				<div class="keMetaInformation"
					 tal:condition="python:not assessment.getIsLocked()">
					Current Status: Unlocked
				</div>
				<div class="keMetaInformation"
           tal:define="fullname python:userProviderService.getUser(assessment.getCreatedBy()).getFullname();"
           tal:on-error="string:Report of - User: not available" 
					 tal:content="python:'Report of - User: %s' % fullname">
					Report of - User
				</div>
				<div class="keMetaInformation"
					 tal:content="python:'Report Generated on %s' % here.toLocalizedTime(now, long_format='date_format_short')">
					Generated on YYYY-MM-DD HH:MM PM
				</div>
			</td>
			<td align="right" valign="top">
				<input type="button" class="keButton" value="Save As HTML" onclick=""
					   tal:attributes="onclick python:'saveAsMe(\'%s - %s.html\')' % (here.getTitle(), here.getModel().getTitleOrId())" >
				<input type="button" class="keButton" value="Close" onclick=""
             tal:condition="request/exitURL|nothing"
					   tal:attributes="onclick python:'window.location=\'%s\'' % exitURL" />
				<input type="button" class="keButton" value="Back" onClick="history.go(-1)"
             tal:condition="not: request/exitURL|nothing" />					   
			</td>
			<td align="right" valign="top">
                <a href="javascript:this.print();">
                    <img src="/dummy/print_icon.gif" tal:attributes="src string:${portal_url}/print_icon.gif"
                         alt="Print this page"
                         title="Print this page" height="16"
                         width="16" />
                </a>
			</td>
		</tr>
		</table>
		<!-- /Bottom Navigation Bar -->
    
</body>
</html>
